package com.marvels.product.param.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.marvels.common.dto.MarvelsResultDTO;
import com.marvels.common.exception.MarvelsBusinessException;
import com.marvels.common.exception.MarvelsErrorCode;
import com.marvels.common.utils.MarvelsLogUtil;
import com.marvels.product.param.dto.McptAmortMethodDTO;
import com.marvels.product.param.dto.McptConsultingFeeDTO;
import com.marvels.product.param.dto.McptLateFeeDTO;
import com.marvels.product.param.dto.McptManagementFeeDTO;
import com.marvels.product.param.dto.McptMiscFeeDTO;
import com.marvels.product.param.dto.McptPaymentSequenceDTO;
import com.marvels.product.param.dto.McptPaymentSequenceItemDTO;
import com.marvels.product.param.dto.McptPenaltyFeeDTO;
import com.marvels.product.param.dto.McptPlatformFeeDTO;
import com.marvels.product.param.dto.McptPreTerminationFeeDTO;
import com.marvels.product.param.dto.McptProduct;
import com.marvels.product.param.dto.ProductMsgInfoDTO;
import com.marvels.product.param.service.AmortMethodService;
import com.marvels.product.param.service.ConsultingFeeService;
import com.marvels.product.param.service.LateFeeService;
import com.marvels.product.param.service.McptPaymentSequenceItemService;
import com.marvels.product.param.service.MiscFeeService;
import com.marvels.product.param.service.MngFeeService;
import com.marvels.product.param.service.PaymentSequenceService;
import com.marvels.product.param.service.PenaltyFeeService;
import com.marvels.product.param.service.PlatformFeeService;
import com.marvels.product.param.service.PreTerminateFeeService;
import com.marvels.product.param.service.ProductItemService;
import com.marvels.product.productmanage.dto.McptProductFundRelationDto;
import com.marvels.product.productmanage.service.ProductTypeService;




@RequestMapping("/product/param/api")
@RestController
public class ProductMsgApiController {
	@Autowired
	private ProductItemService itemService;
	@Autowired
	private AmortMethodService amortMethodService;
	@Autowired
	private ConsultingFeeService consultingFeeService;
	@Autowired
	private LateFeeService lateFeeService;
	@Autowired
	private MngFeeService mngFeeService;
	@Autowired
	private MiscFeeService miscFeeService;
	@Autowired
	private PaymentSequenceService sequenceService;
	@Autowired
	private PenaltyFeeService penaltyFeeService;
	@Autowired
	private PlatformFeeService platformFeeService;
	@Autowired
	private PreTerminateFeeService preTerminateFeeService;
	@Autowired
	private ProductTypeService productTypeService;
	@Autowired
	private McptPaymentSequenceItemService mcptPaymentSequenceItemService;
	/**根据productCode查询产品小类
	 * @author 娄凯琦
	 * @date 2018年5月8日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryProductByProductCode")
	public MarvelsResultDTO queryByProductCode(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryByProductCode ==="+JSON.toJSONString(dto));
			McptProduct mcptProduct=itemService.getByProductCode(dto);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), mcptProduct);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	/**根据小类code查询还款方式
	 * @author 娄凯琦
	 * @date 2018年5月8日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryAmortMethodByAmortMethodCode")
	public MarvelsResultDTO queryAmortMethodByAmortMethodCode(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryAmortMethodByAmortMethodCode ==="+JSON.toJSONString(dto));
			McptAmortMethodDTO mcptAmortMethodDTO =amortMethodService.getAmortMethodByAmortMethodCode(dto);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), mcptAmortMethodDTO);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	/**根据小类code查询咨询费
	 * @author 娄凯琦
	 * @date 2018年5月8日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryConsultingFeeByConsultingFeeCode")
	public MarvelsResultDTO queryConsultingFeeByConsultingFeeCode(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryConsultingFeeByConsultingFeeCode ==="+JSON.toJSONString(dto));
			McptConsultingFeeDTO mcptConsultingFeeDTO = consultingFeeService.getConsultingFeeByConsultingFeeCode(dto);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(),mcptConsultingFeeDTO);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	
	/**根据小类code查询滞纳金
	 * @author 娄凯琦
	 * @date 2018年5月8日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryLateFeeByLateFeeCode")
	public MarvelsResultDTO queryLateFeeByLateFeeCode(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryLateFeeByLateFeeCode ==="+JSON.toJSONString(dto));
			McptLateFeeDTO mcptLateFeeDTO = lateFeeService.getLateFeeByLateFeeCode(dto);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), mcptLateFeeDTO);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	/**查询管理费
	 * @author 娄凯琦
	 * @date 2018年5月9日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryManagementFeeByManageFeeCode")
	public MarvelsResultDTO queryManagementFeeByManageFeeCode(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryManagementFeeByManageFeeCode ==="+JSON.toJSONString(dto));
			McptManagementFeeDTO mcptManagementFeeDTO = mngFeeService.getManagementFeeByManageFeeCode(dto);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), mcptManagementFeeDTO);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	
	/**查询杂费
	 * @author 娄凯琦
	 * @date 2018年5月9日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryMiscFeeByMiscFeeCode")
	public MarvelsResultDTO queryMiscFeeByMiscFeeCode(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryMiscFeeByMiscFeeCode ==="+JSON.toJSONString(dto));
			McptMiscFeeDTO mcptMiscFeeDTO = miscFeeService.getMiscFeeByMiscFeeCode(dto);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), mcptMiscFeeDTO);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	/**查询还款顺序
	 * @author 娄凯琦
	 * @date 2018年5月9日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryPaymentSequenceByPaymentSeq")
	public MarvelsResultDTO queryPaymentSequenceByPaymentSeq(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryPaymentSequenceByPaymentSeq ==="+JSON.toJSONString(dto));
			McptPaymentSequenceDTO mcptPaymentSequence = sequenceService.getPaymentSequenceByPaymentSeq(dto);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), mcptPaymentSequence);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	/**查询还款顺序明细
	 * @author 娄凯琦
	 * @date 2018年5月9日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryPaymentSequenceItemByPaymentSeq")
	public MarvelsResultDTO queryPaymentSequenceItemByPaymentSeq(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryPaymentSequenceByPaymentSeq ==="+JSON.toJSONString(dto));
			List<McptPaymentSequenceItemDTO> list= mcptPaymentSequenceItemService.getPaymentSequenceItemBySequenceCode(dto);
			ProductMsgInfoDTO msgDto = new ProductMsgInfoDTO();
			msgDto.setMcptPaymentSequenceItemDTO(list);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), msgDto);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	
	/**根据违约金code查询违约金
	 * @author 娄凯琦
	 * @date 2018年5月9日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryPenaltyFeeByPenaltyFeeCode")
	public MarvelsResultDTO queryPenaltyFeeByPenaltyFeeCode(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryPenaltyFeeByPenaltyFeeCode ==="+JSON.toJSONString(dto));
			McptPenaltyFeeDTO mcptPenaltyFeeDTO = penaltyFeeService.getPenaltyFeeByPenaltyFeeCode(dto);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), mcptPenaltyFeeDTO);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	
	/**根据违约金code查询平台费
	 * @author 娄凯琦
	 * @date 2018年5月9日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryPlatformFeeByPlatformFeeCode")
	public MarvelsResultDTO queryPlatformFeeByPlatformFeeCode(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryPlatformFeeByPlatformFeeCode ==="+JSON.toJSONString(dto));
			McptPlatformFeeDTO mcptPlatformFeeDTO = platformFeeService.getPlatformFeeByPlatformFeeCode(dto);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), mcptPlatformFeeDTO);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	/**根据违约金code查询提前结清
	 * @author 娄凯琦
	 * @date 2018年5月9日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryPreTerminateFeeByPreTerminateFeeCode")
	public MarvelsResultDTO queryPreTerminateFeeByPreTerminateFeeCode(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryPreTerminateFeeByPreTerminateFeeCode ==="+JSON.toJSONString(dto));
			McptPreTerminationFeeDTO mcptPreTerminationFeeDTO = preTerminateFeeService.getPreTerminateFeeByPreTerminateFeeCode(dto);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), mcptPreTerminationFeeDTO);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	
	/**根据productCode查询rate
	 * @author 娄凯琦
	 * @date 2018年5月9日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryRateByProductCode")
	public MarvelsResultDTO queryRateByProductCode(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryRateByProductCode ==="+JSON.toJSONString(dto));
			List<McptProductFundRelationDto> mcptProductFundRelationDto = productTypeService.getRateByProductCode(dto);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), mcptProductFundRelationDto);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	/**根据小类code所有费率和小类信息
	 * @author 娄凯琦
	 * @date 2018年5月9日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryFeeRateByProductCode")
	public MarvelsResultDTO queryFeeRateByProductCode(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryFeeRateByProductCode ==="+JSON.toJSONString(dto));
			//产品映射资金源
			List<McptProductFundRelationDto> mcptProductFundRelationDto = productTypeService.getRateByProductCode(dto);
			//产品小类信息
			McptProduct mcptProduct=itemService.getByProductCode(dto);
			//还款方式
			McptAmortMethodDTO mcptAmortMethodDTO =amortMethodService.getAmortMethodByAmortMethodCode(mcptProduct);
			//咨询费
			McptConsultingFeeDTO mcptConsultingFeeDTO = consultingFeeService.getConsultingFeeByConsultingFeeCode(mcptProduct);
			MarvelsLogUtil.getInstance().info(JSON.toJSONString(mcptProduct));
			//管理费
			McptManagementFeeDTO mcptManagementFeeDTO = mngFeeService.getManagementFeeByManageFeeCode(mcptProduct);
			//平台费
			McptPlatformFeeDTO mcptPlatformFeeDTO = platformFeeService.getPlatformFeeByPlatformFeeCode(mcptProduct);
			//杂费
			McptMiscFeeDTO mcptMiscFeeDTO = miscFeeService.getMiscFeeByMiscFeeCode(mcptProduct);
			//违约金
			McptPenaltyFeeDTO mcptPenaltyFeeDTO = penaltyFeeService.getPenaltyFeeByPenaltyFeeCode(mcptProduct);
			//滞纳金
			McptLateFeeDTO mcptLateFeeDTO = lateFeeService.getLateFeeByLateFeeCode(mcptProduct);
			//提前结清费信息
			McptPreTerminationFeeDTO mcptPreTerminationFeeDTO = preTerminateFeeService.getPreTerminateFeeByPreTerminateFeeCode(mcptProduct);
			//信息集合dto
			ProductMsgInfoDTO productMsgInfoDTO = new ProductMsgInfoDTO();
			productMsgInfoDTO.setMcptProduct(mcptProduct);
			productMsgInfoDTO.setMcptAmortMethodDTO(mcptAmortMethodDTO);
			productMsgInfoDTO.setMcptConsultingFeeDTO(mcptConsultingFeeDTO);
			productMsgInfoDTO.setMcptManagementFeeDTO(mcptManagementFeeDTO);
			productMsgInfoDTO.setMcptPlatformFeeDTO(mcptPlatformFeeDTO);
			productMsgInfoDTO.setMcptMiscFeeDTO(mcptMiscFeeDTO);
			productMsgInfoDTO.setMcptProductFundRelationDto(mcptProductFundRelationDto);
			productMsgInfoDTO.setMcptPreTerminationFeeDTO(mcptPreTerminationFeeDTO);
			productMsgInfoDTO.setMcptPenaltyFeeDTO(mcptPenaltyFeeDTO);
			productMsgInfoDTO.setMcptLateFeeDTO(mcptLateFeeDTO);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), productMsgInfoDTO);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	
	/**查询提前结清信息
	 * @author 娄凯琦
	 * @date 2018年5月22日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryPrePayTrailMsg")
	public MarvelsResultDTO queryPrePayTrailMsg(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryPrePayTrailMsg ==="+JSON.toJSONString(dto));
			//产品小类信息
			McptProduct mcptProduct=itemService.getByProductCode(dto);
			//还款方式
			McptAmortMethodDTO mcptAmortMethodDTO =amortMethodService.getAmortMethodByAmortMethodCode(mcptProduct);
			//提前结清费信息
			McptPreTerminationFeeDTO mcptPreTerminationFeeDTO = preTerminateFeeService.getPreTerminateFeeByPreTerminateFeeCode(mcptProduct);
			//信息集合dto
			ProductMsgInfoDTO productMsgInfoDTO = new ProductMsgInfoDTO();
			productMsgInfoDTO.setMcptProduct(mcptProduct);
			productMsgInfoDTO.setMcptAmortMethodDTO(mcptAmortMethodDTO);
			productMsgInfoDTO.setMcptPreTerminationFeeDTO(mcptPreTerminationFeeDTO);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), productMsgInfoDTO);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
	
	
	
	/**查询冲账所需信息
	 * @author 娄凯琦
	 * @date 2018年5月22日  
	 * @param dto
	 * @return
	 */
	@RequestMapping("queryStrikeBalanceMsg")
	public MarvelsResultDTO queryStrikeBalanceMsg(@RequestBody McptProduct dto){
		try {
			MarvelsLogUtil.getInstance().info("the method queryPrePayTrailMsg ==="+JSON.toJSONString(dto));
			//产品小类信息
			McptProduct mcptProduct=itemService.getByProductCode(dto);
			//还款方式
			McptAmortMethodDTO mcptAmortMethodDTO =amortMethodService.getAmortMethodByAmortMethodCode(mcptProduct);
			//提前结清费信息
			McptPreTerminationFeeDTO mcptPreTerminationFeeDTO = preTerminateFeeService.getPreTerminateFeeByPreTerminateFeeCode(mcptProduct);
			//还款顺序
			MarvelsLogUtil.getInstance().info("the method mcptProduct ==="+JSON.toJSONString(mcptProduct));
			List<McptPaymentSequenceItemDTO> list= mcptPaymentSequenceItemService.getPaymentSequenceItemBySequenceCode(mcptProduct);
			//信息集合dto
			ProductMsgInfoDTO productMsgInfoDTO = new ProductMsgInfoDTO();
			productMsgInfoDTO.setMcptProduct(mcptProduct);
			productMsgInfoDTO.setMcptPaymentSequenceItemDTO(list);
			productMsgInfoDTO.setMcptAmortMethodDTO(mcptAmortMethodDTO);
			productMsgInfoDTO.setMcptPreTerminationFeeDTO(mcptPreTerminationFeeDTO);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(), productMsgInfoDTO);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage());
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}
}
